
<%= @bienngay %>
	<%= form_tag({:controller => 'articles',:action => 'search'}) do %>
		<h1>Filter Condital</h1>
	<table border="1px" bordercolor="black" bgcolor="#f3f0f3">
  	<tr>
    	<th>Text</th>
    	<th>Author</th>
    	<th>Start publishing</th>
    	<th>Finish publishing</th>
    	<th>Status</th>
    	<th>Access level</th>
  	</tr>
  	<tr>
    	<td><input type="text" name="txtText"></td>
		<td><select name="article[user_id]">
				<% @user.each do |user| %>
					<option value= <%= user.id %> > <%= user.username %></option>
				<% end %>
			</select></td>
		<td>
		<input id="datepicker" type="text" name="start_date" />
		</td>		
		<td><input id="datepicker1"  type="text" name="finish_date" /></td>
    	<td><select name="article[status_id]">
				<% @status.each do |status| %>
					<option value= <%= status.id %> > <%= status.name %></option>
				<% end %>
			</select></td>
    	<td><select name="article[access_level_id]">
				<% @access_level.each do |access_level| %>
					<option value= <%= access_level.id %> > <%= access_level.name %></option>
				<% end %>
			</select></td>
  	</tr>
	</table>
		<input id="search" name="search" type="submit" value="Search"/> 	
	<% end %>
	
  	<%= form_tag({:controller => 'articles', :action => 'delete_selected'}) do %>
 <h1>Listing articles</h1>
	<table border="1px" bordercolor="black" bgcolor="#f3f0f3">
  <tr>
    <th>Title</th>
    <th>Body</th>
    <th>Start publishing</th>
    <th>Finish publishing</th>
    <th>Alias</th>
    <th>Status</th>
    <th>Access level</th>
    <th>User</th>
    <th>Event</th>
    <th></th>
    <th></th>
    <th></th>
	<th>Selection</th>

  </tr>

<% @articles.each do |article| %>
  <tr>
    <td><%= article.title %></td>
    <td><%= article.body %></td>
    <td><%= article.start_publishing %></td>
    <td><%= article.finish_publishing %></td>
    <td><%= article.alias %></td>
    <td><%= article.status.name %></td>
    <td><%= article.access_level.name if !article.access_level.nil? %></td>
    <td><%= article.user.username if !article.user.nil? %></td>
    <td><%= article.event.name %></td>
    <td><%= link_to 'Show', article %></td>
    <td><%= link_to 'Edit', edit_article_path(article) %></td>
    <td><%= link_to 'Destroy', article, :confirm => 'Are you sure?', :method => :delete %></td>
	<td><input type="checkbox" name="ids[<%= article.id.to_s %>]" value="<%= article.id %>"</td>
  </tr>
<% end %>
</table>

<br />

<div class="actions"> 
    <input id="new_article_path" name="commit" type="button" onclick="window.location = '<%= new_article_path %>'" value="New Article"/>
	<input id="article" name="delete" type="submit" data-confirm="Are you sure?"  value="Delete"/> 
  </div> 
  <%= link_to 'New Article', new_article_path %>
	<% end %>


